package com.niit.order.service.impl;

import com.niit.order.pojo.User;
import com.niit.order.service.MyUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author yaojianfeng
 */
@Service("myUserClient")
public class MyMyUserClient implements MyUserClient {

    @Autowired
    RestTemplate restTemplate;

    @Override
    public User findUserById(String id) {
        return null;
    }

    @Override
    public String requestParam(String name) {
        //2.1 url路径
        String url = "http://userservice/provider/feign/request?name=" + name;
        //2.2 发送http请求,实现远程调用
        return restTemplate.getForObject(url, String.class);

    }

    @Override
    public User headerInfo(String name, String address) {
        return null;
    }

    @Override
    public String bodyInfo(User user) {
        return "";
    }
}
